跳到主要内容

Fortran 递归过程

recursive subroutine fact(n, result)
if (n >= 1) then
call fact(n-1, temp)
result = n * temp
else
result = 1
end if
end subroutine fact